/*
 * shortread.h
 *
 *  Created on: Aug 12, 2011
 *      Author: Pierre Lindenbaum PhD
 *              plindenbaum@yahoo.fr
 *              http://plindenbaum.blogspot.com
 *              
 */

#ifndef SHORTREAD_H_
#define SHORTREAD_H_
#include <iostream>
#include "xstdio.h"
#include "bio.h"

class ShortRead:public DelegateCharSequence
    {
    protected:
	ShortRead();
    public:
	virtual ~ShortRead();
	virtual const char* name() const=0;
	virtual const char* name2() const=0;
	virtual const CharSequence* delegate() const=0;
	virtual const CharSequence* sequence() const=0;
	virtual const CharSequence* qualities() const=0;
	virtual void printFastQ(std::ostream& out) const;
    };

class DefaultShortRead:public ShortRead
    {
    private:
	char* _name;
	size_t _len;
	char* _seq;
	char* _name2;
	char* _qual;
	DefaultShortRead();
	CharSequence* _sequence;
	CharSequence* _qualities;
    public:
	virtual ~DefaultShortRead();
	virtual const CharSequence* delegate() const;
	static DefaultShortRead* read(LineReader* in);
	virtual const char* name() const;
	virtual const char* name2() const;
	virtual const CharSequence* sequence() const;
	virtual const CharSequence* qualities() const;
    };

class TrimmedShortRead:public ShortRead
    {
    private:
	const ShortRead* _owned;
	SubStringSequence* _subseq;
	SubStringSequence* _qual;
    public:
	TrimmedShortRead(const ShortRead* owned,size_type pos,size_type len);
	virtual ~TrimmedShortRead();
	virtual const char* name() const;
	virtual const char* name2() const;
	virtual const CharSequence* delegate() const;
	virtual const CharSequence* sequence() const;
	virtual const CharSequence* qualities() const;
    };


#endif /* SHORTREAD_H_ */
